/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ucmconfchecker.pUCM;

import edu.uci.ics.jung.algorithms.layout.Layout;
import java.util.ArrayList;
import java.util.HashMap;

/**
 *
 * @author Administrador
 */

public class UCM {
    
    private Layout layout;
    
    private ArrayList<ComponentInstance> instances;
    private ArrayList<UCMNode> nodes;
    private HashMap<UCMNode,ArrayList<UCMNode>> arcs;
    private HashMap<UCMNode,ArrayList<UCMNode>> preconditions;
    private ArrayList<UCMNode> starts;
    public UCM(ArrayList<ComponentInstance> instances,ArrayList<UCMNode> nodes,
               HashMap<UCMNode,ArrayList<UCMNode>> arcs,HashMap<UCMNode,ArrayList<UCMNode>> preconditions,
               ArrayList<UCMNode> starts)
    {   this.instances=instances;
        this.nodes = nodes;
        this.arcs = arcs;
        this.preconditions = preconditions;
        this.starts = starts;
    }
    
    @Override
    public String toString(){
        String result = "";
        for(UCMNode origin: getNodes()){
            result+=(""+origin);
            ArrayList<UCMNode> arcsNode = getArcs().get(origin);
            if(arcsNode!=null){
                result+= " ==>{ ";
                for(UCMNode destiny: arcsNode)
                    result+=(""+destiny+" , ");
                result+=(" }");
            }result+="\n";
        }
        return result;
    }

    /**
     * @return the instances
     */
    public ArrayList<ComponentInstance> getInstances() {
        return instances;
    }

    /**
     * @return the nodes
     */
    public ArrayList<UCMNode> getNodes() {
        return nodes;
    }

    /**
     * @return the arcs
     */
    public HashMap<UCMNode,ArrayList<UCMNode>> getArcs() {
        return arcs;
    }

    /**
     * @return the preconditions
     */
    public HashMap<UCMNode,ArrayList<UCMNode>> getPreconditions() {
        return preconditions;
    }

    /**
     * @return the starts
     */
    public ArrayList<UCMNode> getStarts() {
        return starts;
    }

    public Layout getLayout() {
        return layout;
    }

    public void setLayout(Layout layout) {
        this.layout = layout;
    }
    

}
